﻿using System.Web.Mvc;
using System.Collections.Generic;
using System;
namespace GBlog.Core.Service.Default
{
    public class Services : IServices
    {
        internal static Dictionary<Type, object> ServiceList = new Dictionary<Type, object>();
        public T Get<T>()
        {
            object service;
            if (!ServiceList.TryGetValue(typeof(T), out service) || service.Equals(default(T)))
            {
                service = DependencyResolver.Current.GetService<T>();
                ServiceList[typeof(T)] = service;
            }
            return (T)service;
        }
    }
}